<script>
<!--
$(document).ready(function()
{
	$('#sections-grid input').keydown(function(evt) {
		evt = (evt) ? evt : event;
		var charCode = (evt.charCode) ? evt.charCode :
			((evt.which) ? evt.which : evt.keyCode);
		if (charCode == 13) {
			return false;
		} else {
			return true;
		}
	});
});
-->
</script>

<h1>Управление разделами</h1>

<!-- create new -->
<hr />
<h3>Добавить раздел</h3>
<?php echo $this->renderPartial('_form', array('model'=>$model_create)); ?>
<hr />

<!-- admin -->
<?php echo CHtml::beginForm("index.php?r=admin/sections/saveall", "post"); ?>
<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'sections-grid',
	'dataProvider'=>$model->search(),
	//'filter'=>$model,
	'columns'=>array(
		'id',
		'name',
		//'order_id',
		array(
			'name'=>'order_id',
			'value'=>'CHtml::textField("item[".$data->id."][order]", $data->order_id, array("size"=>"5"))',
			'type'=>'raw',
		),
		//'enabled',
		array(
			'name'=>'enabled',
			'value'=>'CHtml::checkBox("item[".$data->id."][enabled]", $data->enabled)',
			'type'=>'raw',
		),
		array(
			'class'=>'CButtonColumn',
			'template'=>'{update} {delete}',
		),
	),
)); ?>
<br />
<?php echo CHtml::submitButton('Сохранить изменения'); ?>
<?php echo CHtml::endForm(); ?>
<br />

